package com.vincent.message;

import com.vincent.common.Message;
import com.vincent.common.MessageType;
import com.vincent.utils.BallotNumber;

/**
 * Created by wensen on 2016/12/7.
 *
 * 由Acceptors发送给Commander的p2阶段消息
 * 包含了ballot和slot
 **/
public class P2bMessage extends Message{

    private final BallotNumber ballot_number;
    private final long slot_number;

    public P2bMessage(int src, BallotNumber ballot, long slot) {
        super(src);
        this.ballot_number = ballot;
        this.slot_number = slot;
    }

    public BallotNumber ballot_number() {
        return this.ballot_number;
    }

    public long slot_number() {
        return this.slot_number;
    }

    public int messageType() {
        return MessageType.P2B_MESSAGE;
    }

    public String toString() {
        return "{P2bMessage [src: " + src() +
                " ballot: " + ballot_number +
                " slot: " + slot_number +"]}";
    }

}
